@SETLOCAL
@ECHO OFF

SET Server=ericleb
SET HomeUXPath=c$\mydev\HomeUX

ECHO Building...
CALL Make.bat deb

ECHO Stopping the HomeUX service...
sc \\%Server% stop HomeUX > nul
:StopWait
sc \\%Server% interrogate HomeUX > nul
IF "%errorlevel%"=="1061" GOTO StopWait

ECHO Copying executables...
XCOPY /S /I /Y %~dp0bin\Debug \\%Server%\%HomeUXPath%\Server\bin\Debug
XCOPY /S /I /Y %~dp0..\Client\bin\Debug \\%Server%\%HomeUXPath%\Client\bin\Debug

ECHO Restarting the HomeUX service...
sc \\%Server% start HomeUX > nul
:StartWait
sc \\%Server% continue HomeUX > nul
IF "%errorlevel%"=="1061" GOTO StartWait
IF "%errorlevel%"=="1062" GOTO StartWait

sc \\%Server% interrogate HomeUX

ECHO Done.

